<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组方法扩展·</title>
</head>
<body>
<script>
  //flat -- 将多维数组转换为低维数组
  const arr=[1,2,3,4,5,[6,7,[8,9],[0]]]
  console.log(arr.flat(2)) // 2 --- 表示深度 将多维数组展开多少层

  //flatMap
  const arr1=[1,2,3,4]
  const result1=arr1.flatMap(item=>[item*10])
  console.log(result1)
</script>
</body>
</html>